﻿<Alert ShowBar="true" ShowBorder="true" Color="Color.Info">
    <div>@AlertInfoText</div>
</Alert>
<Alert ShowBar="true" ShowBorder="true" Color="Color.Success">
    <div>@AlertSuccessText</div>
</Alert>
<Alert ShowBar="true" ShowBorder="true" Color="Color.Primary">
    <div>@AlertPrimaryText</div>
</Alert>
<Alert ShowBar="true" ShowBorder="true" Color="Color.Warning">
    <div>@AlertWarningText</div>
</Alert>
<Alert ShowBar="true" ShowBorder="true" Color="Color.Danger">
    <div>@AlertDangerText</div>
</Alert>

@code
{
    [Inject]
    [NotNull]
    private IStringLocalizer<AlertShowBar>? Localizer { get; set; }

    [NotNull]
    private string? AlertPrimaryText { get; set; }

    [NotNull]
    private string? AlertSuccessText { get; set; }

    [NotNull]
    private string? AlertDangerText { get; set; }

    [NotNull]
    private string? AlertWarningText { get; set; }

    [NotNull]
    private string? AlertInfoText { get; set; }

    protected override void OnInitialized()
    {
        base.OnInitialized();

        AlertPrimaryText ??= Localizer[nameof(AlertPrimaryText)];
        AlertDangerText ??= Localizer[nameof(AlertDangerText)];
        AlertSuccessText ??= Localizer[nameof(AlertSuccessText)];
        AlertWarningText ??= Localizer[nameof(AlertWarningText)];
        AlertInfoText ??= Localizer[nameof(AlertInfoText)];
    }
}
